package com.xinyiweidai.xinyiweidai.module.my;

import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;

import com.lan.mylibrary.ui.MyTitle;
import com.lan.mylibrary.ui.MyToast;
import com.xinyiweidai.xinyiweidai.R;
import com.xinyiweidai.xinyiweidai.base.BaseActivity;

/**
* 项目名：com.xinyiweidai.xinyiweidai.module.helpCenter
* 类名： ComplainActivity
* 创建人：Lan
* 创建时间：2018/9/8 21:21
* 描述：  投诉
*/
public class ComplainActivity extends BaseActivity {


    private EditText et_complaint;
    private Button btn_complaint_send;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_complain;
    }


    @Override
    protected void initToolBar() {
        new MyTitle(this, R.drawable.ic_back,"投诉与建议",0,true);
    }


    @Override
    protected void initView(Bundle savedInstanceState) {
        et_complaint = (EditText) findViewById(R.id.et_complaint);
        btn_complaint_send = (Button) findViewById(R.id.btn_complaint_send);
    }

    @Override
    protected void addClickEvent() {
        btn_complaint_send.setOnClickListener(view -> checkComplain());
    }


    private void checkComplain(){
        String complain=et_complaint.getText().toString();
        if (TextUtils.isEmpty(complain)) {
            MyToast.showError(this,"不能为空");
            return;
        }
        sendComplain();
    }


    //模拟发送
    private void sendComplain() {
        showLoading("正在提交");
        new Handler().postDelayed(() -> {
            dismissLoading();
            MyToast.showSuccess(ComplainActivity.this,"提交成功");
            finish();
        }, 1000);
    }
}
